//
//  BrowseSecondTableViewCell.m
//  浏览界面
//
//  Created by lanou on 15/12/17.
//  Copyright © 2015年 lanou. All rights reserved.
//

#define kWidth [UIScreen mainScreen].bounds.size.width
#define kHeight [UIScreen mainScreen].bounds.size.height
#import "BrowseSecondTableViewCell.h"
#import "BrowseModel.h"
#import "UIImageView+AFNetworking.h"
@implementation BrowseSecondTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // 图片
        self.pictureView = [[UIImageView alloc] initWithFrame:(CGRectMake(5, 0, kWidth - 10, kHeight / 2))];
        self.pictureView.backgroundColor = [UIColor yellowColor];
        [self.contentView addSubview:self.pictureView];
        
        // 大标题
        self.titleLabel = [[UILabel alloc] initWithFrame:(CGRectMake(0, kHeight / 6 , kWidth - 10, 50))];
        self.titleLabel.font = [UIFont boldSystemFontOfSize:28];
        self.titleLabel.textAlignment = NSTextAlignmentCenter;
        self.titleLabel.textColor = [UIColor whiteColor];
        [self.pictureView addSubview:self.titleLabel];
        
        // 小标题
        self.numberLabel = [[UILabel alloc] initWithFrame:(CGRectMake(kWidth / 3 - 20 , kHeight / 6 + 50, kWidth / 3 + 40, 50))];
        self.numberLabel.textAlignment = NSTextAlignmentCenter;
        self.numberLabel.font = [UIFont systemFontOfSize:22];
        self.numberLabel.textColor = [UIColor whiteColor];
        self.numberLabel.backgroundColor = [UIColor orangeColor];
        [self.pictureView addSubview:self.numberLabel];
        self.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return self;
}

- (void)setBrowseModel:(BrowseModel *)browseModel {
    self.titleLabel.text = browseModel.title;
    self.numberLabel.text = [NSString stringWithFormat:@"%@ %@",browseModel.col_count,browseModel.col_count_text];
    [self.pictureView setImageWithURL:[NSURL URLWithString:browseModel.pic]];
}





- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
